The high sensitivity of qPCR makes it a desirable diagnostic method in epidemiological surveillance programs. However, due to high costs, the use of pooling has been suggested. In this paper, an algorithm based on the Montecarlo method has been designed and implemented. The algorithm had been tested in many different situations, and finally it was validated with a real dataset. Moreover, based on the results obtained and depending on pooling conditions, a drastic decrease of sensitivity is observed.